package com.dc.refactoring._3_重新组织数据._14_ReplaceSubClassWithFields.step1;

/**
 * Description: Person 人 抽象类
 * @author: gdc
 * @date: 2020/12/4
 * @version 1.0
 */
public abstract class Person {

    abstract boolean isMale();

    abstract char getCode();

}

/**
 * 子类中只是返回了一些简单的常量数据
 */
class Male extends Person{
    @Override
    boolean isMale() {
        return true;
    }

    @Override
    char getCode() {
        return 'M';
    }
}

class Female extends Person{
    @Override
    boolean isMale() {
        return false;
    }

    @Override
    char getCode() {
        return 'F';
    }
}